package com.ayuku.retail.ui.category;

import java.util.logging.Logger;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.wb.swt.SWTResourceManager;

import com.ayuku.commons.Util;

/**
 * 
 * @author putu kusuma <putukn@gmail.com>
 * 
 */
public class CompCategory extends org.eclipse.swt.widgets.Composite {

	protected Text txtName;
	protected Text txtCode;
	private static Logger LOG = Logger.getLogger(CompCategory.class.getName());

	public CompCategory(final org.eclipse.swt.widgets.Composite parent,
			final int style) {
		super(parent, style);
		initGUI();
	}

	private void initGUI() {
		try {

			this.setBackground(SWTResourceManager.getColor(171, 209, 252));
			setLayout(new GridLayout(2, false));

			final Label label1 = new Label(this, SWT.NONE);
			label1.setText("Kode:");
			label1.setAlignment(SWT.RIGHT);
			label1.setBackground(SWTResourceManager.getColor(171, 209, 252));
			label1.setFont(SWTResourceManager.getFont("Tahoma", 10, 0, false,
					false));
			txtCode = new Text(this, SWT.BORDER);
			txtCode.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
					false, 1, 1));
			txtCode.setTextLimit(16);
			txtCode.setFont(SWTResourceManager.getFont("Tahoma", 10, 0, false,
					false));

			final Label label2 = new Label(this, SWT.NONE);
			label2.setText("Nama:");
			label2.setAlignment(SWT.RIGHT);
			label2.setBackground(SWTResourceManager.getColor(171, 209, 252));
			label2.setFont(SWTResourceManager.getFont("Tahoma", 10, 0, false,
					false));

			txtName = new Text(this, SWT.BORDER);
			txtName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
					false, 1, 1));
			txtName.setTextLimit(50);
			txtName.setFont(SWTResourceManager.getFont("Tahoma", 10, 0, false,
					false));

			this.layout();

		} catch (Exception e) {
			e.printStackTrace();
			LOG.info(e.getMessage());
			Util.showMsgBox("Gagal load: " + e.getMessage(), 1, getShell());
		}
	}

}
